#include <iostream>
#include <vector>
using namespace std;

int getMaxLen(vector<int>& nums) {
    int n = nums.size();
    vector<int> f(n + 1), g(n + 1);
    int ret = 0;
    for (int i = 1; i <= n; i++)
    {
        if (nums[i - 1] == 0) continue;
        if (nums[i - 1] > 0)
        {
            f[i] = f[i - 1] + 1;
            g[i] = g[i - 1] > 0 ? g[i - 1] + 1 : 0;
        }
        else
        {
            f[i] = g[i - 1] > 0 ? g[i - 1] + 1 : 0;
            g[i] = f[i - 1] + 1;
        }
        ret = max(ret, f[i]);
    }
    return ret;
}

int main()
{
    vector<int> nums = { -1,-2,-3,0,1 };
    cout << getMaxLen(nums) << endl;
    return 0;
}